<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Document</title>
    <script type="text/javascript" charset="gb2312">
        function judge(){
            var c = document.getElementById("c").value;
            var i=2;
            for(i=2;i<c;i++){
                if(c%i==0){
                    break;
                }
            }
            if(i==c){
                alert("素数");
            }else{
                alert("非素数");
            }



        };
    </script>
</head>
<body>
<input id="c" type="text" /><input type="button" value="判断" onclick="judge()" />
</body>
<html>
